<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('basic',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_newlieshop/index/'),
		array('title'=>'分销中心','icon'=>'icon-dingdan','action'=>'jy_newlieshop/fenxiao.index/'),
		array('title'=>'分佣统计','icon'=>'icon-yiban','action'=>'jy_newlieshop/fenxiao.commission/'),
		array('title'=>'分佣明细','icon'=>'icon-dixiaofei','action'=>'jy_newlieshop/fenxiao.orderfee/'),
		array('title'=>'我的下线','icon'=>'icon-paihao0','action'=>'jy_newlieshop/fenxiao.down/'),
	);	
	$return['item']=$this->plugin_setting('basic');
	$return['item']['ffooternav']=$return['item']['ffooternav']?:$footernav;
	$aitip='启用后才生效！';
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'tip','title'=>$aitip),
					array('type'=>'switch','title'=>'是否启用？','name'=>'is_open'),
					array('type'=>'link','from'=>'action','title'=>'二维码跳转链接','name'=>'share_link','help'=>'默认跳转到商城首页，指定链接后，跳转到指定页面！'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
				'title'=>'上下线关系及分佣资格',
				'list'=>array(
					array('type'=>'radio','title'=>'成为分销商条件','name'=>'become','options'=>'become','help'=>'如果是无条件，将自动成为分销商！无需填写申请！【<red>注意</red>】:设置了《无条件》成为分销商。然后《首次下单，首次付款》是不会再绑定上下关系的。因为已经是分销商的不能成为别人的下级，除非在成为分销商之前成为别人的下级。'),
					array('type'=>'string','title'=>'消费次数达到（次）','name'=>'num','show'=>array('become'=>2)),
					array('type'=>'string','title'=>'消费金额达到（元）','name'=>'money','show'=>array('become'=>3)),
					array('type'=>'radio','title'=>'分销商是否需要审核','name'=>'become_check','options'=>'is'),
					array('type'=>'radio','title'=>'分销商必须完善资料','name'=>'become_reg','options'=>'is'),
					)
			),
			array(
				'title'=>'结算',
				'list'=>array(
					array('type'=>'choose_many','name'=>'admin_ids','title'=>'通知管理员','choose_title'=>'选择通知人','help'=>'如不填写，则不发送结算通知给管理员','action'=>'core/member.get_member/many'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'结算额度（元）','name'=>'balance_money','help'=>'佣金达到该数值才能结算'),
					array('type'=>'string','title'=>'佣金打款手续费（%）','name'=>'balance_per'),
					array('type'=>'switch','title'=>'提现到余额免手续费？','name'=>'balance_credit'),
					array('type'=>'switch','title'=>'下单即可结算？','name'=>'isbuy_jiesuan','help'=>'不开启，则表示，必须完成订单才能结算！'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，佣金才能申请提现,设置0或空，订单完成就可以结算'),
				),
			),
			array(
				'title'=>'分销商等级升级',
				'list'=>array(
						//array('type'=>'switch','title'=>'满足其中一个条件就升级','name'=>'is_level_up_one','help'=>'默认，勾选的条件都要满足才行！'),
						array('type'=>'checkbox','title'=>'分销商升级依据','name'=>'level_up_types','options'=>'leveltype','help'=>''),		
					)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
								array('type'=>'array','name'=>'ffooternav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
		)
	);
	$return['levels']=$this->getall('level',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['levels']['0']=array('id'=>0,'title'=>'默认等级');
	$return['leveltype']=$this->level_up_types;
	$return['otherfee_types']=$this->model('model')->otherfee_types();
	$return['withdraw']=$this->pay_types;
	$return['commissiontype']=$this->commission_types;
	$return['is']=array('0'=>'否','1'=>'是');
	$return['become_child']=array('1'=>'首次点击链接','2'=>'首次下单','3'=>'首次付款');
	$return['become']=array('0'=>'无条件','1'=>'申请','2'=>'消费次数','3'=>'消费金额');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['levelfee_type']=$this->levelfee_type;
	$return['pay_type']=get_pay_types();
	$return['htmls']=$htmls;
	exi($return);
}